package com.example.demo.springboot.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * WorkQueueConsumer:多个消费者[默认轮询]
 *
 * @author zhangxiaoxiang
 * @date 2020/11/16
 */
@Component
@Slf4j
public class WorkQueueConsumer {
    /**
     * @param msg 一个消费者
     */
    @RabbitListener(queuesToDeclare = @Queue("call.work.queue"))
    public void crmListener(String msg) {
        log.info("crm系统收到外呼话单回调[执行业务逻辑]:{}", msg);
    }

    /**
     * @param msg 另一个消费者
     */
    @RabbitListener(queuesToDeclare = @Queue("call.work.queue"))
    public void zhiYuListener(String msg) {
        log.info("zhiYu系统收到外呼话单回调[执行业务逻辑]:{}", msg);
    }
}
